<ion-content>
  <ion-grid>
    <ion-row class="ion-align-items-center">
      <ion-col>
        <ion-card color="dark">
          <ion-card-header class="ion-text-center">
            <ion-card-title>Restore from Backup</ion-card-title>
          </ion-card-header>

          <ion-card-content class="ion-margin">
            <ion-spinner
              *ngIf="loading"
              class="center-spinner"
              name="lines"
            ></ion-spinner>

            <!-- loaded -->
            <ion-item-group *ngIf="!loading" class="ion-text-center">
              <!-- cifs -->
              <h2 class="target-label">Network Folder</h2>
              <p class="ion-padding-bottom ion-text-left">
                Restore StartOS data from a folder on another computer that is
                connected to the same network as your server.
              </p>

              <!-- connect -->
              <ion-item button lines="none" (click)="presentModalCifs()">
                <ion-icon
                  slot="start"
                  name="folder-open-outline"
                  size="large"
                ></ion-icon>
                <ion-label>
                  <b>Open</b>
                </ion-label>
              </ion-item>

              <br />
              <br />

              <!-- drives -->
              <h2 class="target-label">Physical Drive</h2>
              <div class="ion-text-left ion-padding-bottom">
                <p>
                  Restore StartOS data from a physical drive that is plugged
                  directly into your server.
                </p>
                <br />
                <b>
                  Warning. Do not use this option if you are using a Raspberry
                  Pi with an external SSD as your main data drive. The Raspberry
                  Pi cannot not support more than one external drive without
                  additional power and can cause data corruption.
                </b>
              </div>

              <ng-container *ngFor="let mapped of mappedDrives">
                <ion-item
                  button
                  *ngIf="mapped.drive as drive"
                  [disabled]="!driveClickable(mapped)"
                  (click)="select(drive)"
                  lines="none"
                >
                  <ion-icon
                    slot="start"
                    name="save-outline"
                    size="large"
                  ></ion-icon>
                  <ion-label>
                    <h1>{{ drive.label || drive.logicalname }}</h1>
                    <drive-status
                      [hasValidBackup]="mapped.hasValidBackup"
                    ></drive-status>
                    <p>
                      {{ drive.vendor || 'Unknown Vendor' }} - {{ drive.model ||
                      'Unknown Model' }}
                    </p>
                    <p>Capacity: {{ drive.capacity | convertBytes }}</p>
                  </ion-label>
                </ion-item>
              </ng-container>
              <ion-button
                class="ion-margin-top"
                color="primary"
                (click)="refresh()"
              >
                <ion-icon slot="start" name="refresh"></ion-icon>
                Refresh
              </ion-button>
            </ion-item-group>
          </ion-card-content>
        </ion-card>
      </ion-col>
    </ion-row>
  </ion-grid>
</ion-content>
